<?php
/***
* @version $Id: admin_styles.php 336 2007-01-23 08:12:56Z flexiondotorg $
* @copyright (c) 2006 - 2007 Flexion.Org
*            (c) 2004 - 2005 Project Minerva
*            (c) 2001 - 2006 phpBB Group
* @license   http://opensource.org/licenses/gpl-license.php GNU Public License
***/

define('IN_R3BORN', true);

if( !empty($setmodules) )
{
	$module['General']['Styles'] = basename(__FILE__);
	return;
}

//
// Load default header
//
//
// Check if the user has cancled a confirmation message.
//
$root_path = "./../";
$phpEx = substr(strrchr(__FILE__, '.'),	1);

require('./pagestart.' . $phpEx);

$confirm = ( isset($_POST['confirm']) ) ? TRUE : FALSE;
$cancel = ( isset($_POST['cancel']) ) ? TRUE : FALSE;

$no_page_header = (!empty($_POST['send_file']) || $cancel) ? TRUE : FALSE;

if ($cancel)
{
	redirect('admin/' . append_sid("admin_styles.$phpEx", true));
}

$mode = get_var('mode','');

// Start add - Slick Style Admin MOD
if( isset($_POST['addnew']) )
{
	$mode = 'addnew';
}
else if( isset($_POST['create']) )
{
	$mode = 'create';
}
else if( isset($_POST['export']) )
{
	$mode = 'export';
}
// End add - Slick Style Admin MOD


switch( $mode )
{
	case "addnew":
		$install_to = ( isset($_GET['template_name']) ) ? urldecode($_GET['template_name']) : $_POST['template_name'];
		//$style_name = ( isset($_GET['style']) ) ? urldecode($_GET['style']) : $_POST['style'];

		if( isset($install_to) )
		{

			include($root_path. "templates/" . basename($install_to) . "/theme_info.cfg");

			$template_name = $$install_to;
			$found = FALSE;

			//for($i = 0; $i < count($template_name) && !$found; $i++)
			for($j = 0; $j < count($template_name); $j++)
			{
				//if( $template_name[$i]['style_name'] == $style_name )
				// Slick Style Admin MOD: 1 line removed
				// Start add - Slick Style Admin MOD
				$style_name = $template_name[$j]['style_name'];

				$sql = "SELECT themes_id
					FROM " . THEMES_TABLE . "
					WHERE style_name = '" . str_replace("\'", "''", $style_name) . "'";
				if(!$result = $db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Could not query themes table!", "", __LINE__, __FILE__, $sql);
				}

				if(!$db->sql_numrows($result))
				// End add - Slick Style Admin MOD
				{
					while(list($key, $val) = each($template_name[$j]))
					{
						$db_fields[] = $key;
						$db_values[] = str_replace("\'", "''" , $val);
					}
// Slick Style Admin MOD: 2 lines removed
				//}
			//}

					$sql = "INSERT INTO " . THEMES_TABLE . " (";

					for($i = 0; $i < count($db_fields); $i++)
					{
						$sql .= $db_fields[$i];
						if($i != (count($db_fields) - 1))
						{
							$sql .= ", ";
						}
					}

					$sql .= ") VALUES (";

					for($i = 0; $i < count($db_values); $i++)
					{
						$sql .= "'" . $db_values[$i] . "'";
						if($i != (count($db_values) - 1))
						{
							$sql .= ", ";
						}
					}
					$sql .= ")";

					if( !$result = $db->sql_query($sql) )
					{
						message_die(GENERAL_ERROR, "Could not insert theme data!", "", __LINE__, __FILE__, $sql);
					}

			//$message = $lang['Theme_installed'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
			// Start add - Slick Style Admin MOD
					$found = TRUE;
				}
			}

			if ($found)
			{
				$message = $lang['Theme_installed'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
			}
			else
			{
				$message = $lang['Style_exists'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
			}
			// End add - Slick Style Admin MOD
			// Slick Style Admin MOD: 1 line removed

			message_die(GENERAL_MESSAGE, $message);
		}
		else
		{

			$installable_themes = array();

			if( $dir = @opendir($root_path. "templates/") )
			{
				while( $sub_dir = @readdir($dir) )
				{

					if( !is_file(realpath($root_path . 'templates/' .$sub_dir)) && !is_link(realpath($root_path . 'templates/' .$sub_dir)) && $sub_dir != "." && $sub_dir != ".." && $sub_dir != "admin" )
					{
						if( @file_exists(@realpath($root_path. "templates/" . $sub_dir . "/theme_info.cfg")) )
						{
							include($root_path. "templates/" . $sub_dir . "/theme_info.cfg");

							for($i = 0; $i < count($$sub_dir); $i++)
							{
								$working_data = $$sub_dir;

								$style_name = $working_data[$i]['style_name'];

								$sql = "SELECT themes_id
									FROM " . THEMES_TABLE . "
									WHERE style_name = '" . str_replace("\'", "''", $style_name) . "'";
								if(!$result = $db->sql_query($sql))
								{
									message_die(GENERAL_ERROR, "Could not query themes table!", "", __LINE__, __FILE__, $sql);
								}

								if(!$db->sql_numrows($result))
								{
									$installable_themes[] = $working_data[$i];
								}
							}
						}
					}
				}

				$template->set_filenames(array(
					"body" => "styles_addnew_body.tpl")
				);

				$template->assign_vars(array(
					"L_STYLES_TITLE" => $lang['Styles_admin'],
					"L_STYLES_ADD_TEXT" => $lang['Styles_addnew_explain'],
					"L_STYLE" => $lang['Style'],
					"L_TEMPLATE" => $lang['Template'],
					"L_INSTALL" => $lang['Install'],
					"L_ACTION" => $lang['Action'])
				);

				for($i = 0; $i < count($installable_themes); $i++)
				{
					$row_class = ( !($i % 2) ) ? 'row1' : 'row2';

					$template->assign_block_vars("styles", array(
						"ROW_CLASS" => $row_class,
						"STYLE_NAME" => $installable_themes[$i]['style_name'],
						"TEMPLATE_NAME" => $installable_themes[$i]['template_name'],

						"U_STYLES_INSTALL" => append_sid("admin_styles.$phpEx?mode=addnew&amp;style=" . urlencode($installable_themes[$i]['style_name']) . "&amp;template_name=" . urlencode($installable_themes[$i]['template_name'])))
					);

				}
				$template->pparse("body");

			}
			closedir($dir);
		}
		break;

	case "create":
	case "edit":
		$submit = ( isset($_POST['submit']) ) ? TRUE : 0;

		if( $submit )
		{
			//
			// Validate the data
			//
			$updated['style_name'] = $_POST['style_name'];
			$updated['template_name'] = $_POST['template_name'];
			$updated['head_stylesheet'] = $_POST['head_stylesheet'];
			$style_id = intval($_POST['style_id']);

			if($mode == "edit")
			{
				$sql = "UPDATE " . THEMES_TABLE . " SET ";
				$count = 0;

				while(list($key, $val) = each($updated))
				{
					if($count != 0)
					{
						$sql .= ", ";
					}

					//
					// I don't like this but it'll keep MSSQL from throwing
					// an error and save me alot of typing
					//
					//$sql .= ( stristr($key, "fontsize") ) ? "$key = $val" : "$key = '" . str_replace("\'", "''", $val) . "'";
					$sql .= "$key = '" . str_replace("\'", "''", $val) . "'";

					$count++;
				}

				$sql .= " WHERE themes_id = $style_id";

				if(!$result = $db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Could not update themes table!", "", __LINE__, __FILE__, $sql);
				}

				$message = $lang['Theme_updated'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

				message_die(GENERAL_MESSAGE, $message);
			}
			else
			{
				//
				// First, check if we already have a style by this name
				//
				$sql = "SELECT themes_id
					FROM " . THEMES_TABLE . "
					WHERE style_name = '" . str_replace("\'", "''", $updated['style_name']) . "'";
				if(!$result = $db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Could not query themes table", "", __LINE__, __FILE__, $sql);
				}

				if($db->sql_numrows($result))
				{
					message_die(GENERAL_ERROR, $lang['Style_exists'], $lang['Error']);
				}

				while(list($key, $val) = each($updated))
				{
					$field_names[] = $key;

					//if(stristr($key, "fontsize"))
					//{
					//	$values[] = "$val";
					//}
					//else
					//{
						$values[] = "'" . str_replace("\'", "''", $val) . "'";
					//}
				}

				$sql = "INSERT
					INTO " . THEMES_TABLE . " (";
				for($i = 0; $i < count($field_names); $i++)
				{
					if($i != 0)
					{
						$sql .= ", ";
					}
					$sql .= $field_names[$i];
				}

				$sql .= ") VALUES (";
				for($i = 0; $i < count($values); $i++)
				{
					if($i != 0)
					{
						$sql .= ", ";
					}
					$sql .= $values[$i];
				}
				$sql .= ")";

				if(!$result = $db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Could not update themes table!", "", __LINE__, __FILE__, $sql);
				}

				$style_id = $db->sql_nextid();

				//
				// Insert names data
				/*
				$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, ";
				while(list($key, $val) = each($updated_name))
				{
					$fields[] = $key;
					$vals[] = $val;
				}

				for($i = 0; $i < count($fields); $i++)
				{
					if($i > 0)
					{
						$sql .= ", ";
					}
					$sql .= $fields[$i];
				}

				$sql .= ") VALUES ($style_id, ";
				for($i = 0; $i < count($vals); $i++)
				{
					if($i > 0)
					{
					$sql .= ", ";
					}
				$sql .= "'" . $vals[$i] . "'";
				}

				$sql .= ")";

				if(!$result = $db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Could not insert themes name table!", "", __LINE__, __FILE__, $sql);
				}
				*/

				$message = $lang['Theme_created'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

				message_die(GENERAL_MESSAGE, $message);
			}
		}
		else
		{
			if($mode == "edit")
			{
				$themes_title = $lang['Edit_theme'];
				$themes_explain = $lang['Edit_theme_explain'];

				$style_id = intval($_GET['style_id']);

				$selected_names = array();
				$selected_values = array();
				//
				// Fetch the Theme Info from the db
				//
				$sql = "SELECT *
					FROM " . THEMES_TABLE . "
					WHERE themes_id = $style_id";
				if(!$result = $db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Could not get data from themes table", "", __LINE__, __FILE__, $sql);
				}

				if ( $selected_values = $db->sql_fetchrow($result) )
				{
					while(list($key, $val) = @each($selected_values))
					{
						$selected[$key] = $val;
					}
				}

				//
				// Fetch the Themes Name data
				//
				/*
				$sql = "SELECT *
					FROM " . THEMES_NAME_TABLE . "
					WHERE themes_id = $style_id";
				if(!$result = $db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Could not get data from themes name table", "", __LINE__, __FILE__, $sql);
				}

				if ( $selected_names = $db->sql_fetchrow($result) )
				{
					while(list($key, $val) = @each($selected_names))
					{
						$selected[$key] = $val;
					}
				}
				*/

				$s_hidden_fields = '<input type="hidden" name="style_id" value="' . $style_id . '" />';
			}
			else
			{
				$themes_title = $lang['Create_theme'];
				$themes_explain = $lang['Create_theme_explain'];
				// Start add - Slick Style Admin MOD
				$selected['template_name'] = isset($_POST['template_name']) ? $_POST['template_name'] : '';
				// End add - Slick Style Admin MOD
			}

			$template->set_filenames(array(
				"body" => "styles_edit_body.tpl")
			);

			if( $dir = @opendir($root_path . 'templates/') )
			{
				$s_template_select = '<select name="template_name">';
				while( $file = @readdir($dir) )
				{
### R3-born - ADD (Global Admin Template)
#					if( !is_file(realpath($root_path . 'templates/' . $file)) && !is_link(realpath($root_path . 'templates/' . $file)) && $file != "." && $file != ".." && $file != "CVS" )
					if( !is_file(realpath($root_path . 'templates/' . $file)) && !is_link(realpath($root_path . 'templates/' . $file)) && $file != "." && $file != ".." && $file != "CVS"  && $file != 'admin' )
#
### R3-born - END ADD
					{
						if($file == $selected['template_name'])
						{
							$s_template_select .= '<option value="' . $file . '" selected="selected">' . $file . "</option>\n";
						}
						else
						{
							$s_template_select .= '<option value="' . $file . '">' . $file . "</option>\n";
						}
					}
				}
				$s_template_select .= '</select>';
			}
			else
			{
				message_die(GENERAL_MESSAGE, $lang['No_template_dir']);
			}

			$s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';

			$template->assign_vars(array(
				"L_THEMES_TITLE" => $themes_title,
				"L_THEMES_EXPLAIN" => $themes_explain,
				"L_THEME_NAME" => $lang['Theme_name'],
				"L_TEMPLATE" => $lang['Template'],
				"L_THEME_SETTINGS" => $lang['Theme_settings'],
				//"L_THEME_ELEMENT" => $lang['Theme_element'],
				//"L_SIMPLE_NAME" => $lang['Simple_name'],
				"L_VALUE" => $lang['Value'],
				"L_STYLESHEET" => $lang['Stylesheet'],
				"L_STYLESHEET_EXPLAIN" => $lang['Stylesheet_explain'],
				"L_SAVE_SETTINGS" => $lang['Save_Settings'],
				"THEME_NAME" => $selected['style_name'],
				"HEAD_STYLESHEET" => $selected['head_stylesheet'],
				"S_THEME_ACTION" => append_sid("admin_styles.$phpEx"),
				"S_TEMPLATE_SELECT" => $s_template_select,
				"S_HIDDEN_FIELDS" => $s_hidden_fields)
			);

			$template->pparse("body");
		}
		break;
	case "export";
		if($_POST['template_name'])
		{
			$template_name = $_POST['template_name'];

			$sql = "SELECT *
				FROM " . THEMES_TABLE . "
				WHERE template_name = '" . str_replace("\'", "''", $template_name) . "'";
			if(!$result = $db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, "Could not get theme data for selected template", "", __LINE__, __FILE__, $sql);
			}

			$theme_rowset = $db->sql_fetchrowset($result);

			if( count($theme_rowset) == 0 )
			{
				message_die(GENERAL_MESSAGE, $lang['No_themes']);
			}

			$theme_data = '<?php'."\n\n";
			$theme_data .= "//\n// R3-born auto-generated theme config file for $template_name\n// Do not change anything in this file!\n//\n\n";

			for($i = 0; $i < count($theme_rowset); $i++)
			{
				while(list($key, $val) = each($theme_rowset[$i]))
				{
					if(!intval($key) && $key != "0" && $key != "themes_id")
					{
						$theme_data .= '$' . $template_name . "[$i]['$key'] = \"" . addslashes($val) . "\";\n";
					}
				}
				$theme_data .= "\n";
			}

			$theme_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!

			@umask(0111);

			$fp = @fopen($root_path . 'templates/' . basename($template_name) . '/theme_info.cfg', 'w');

			if( !$fp )
			{
				//
				// Unable to open the file writeable do something here as an attempt
				// to get around that...
				//
				$s_hidden_fields = '<input type="hidden" name="theme_info" value="' . htmlspecialchars($theme_data) . '" />';
				$s_hidden_fields .= '<input type="hidden" name="send_file" value="1" /><input type="hidden" name="mode" value="export" />';

				$download_form = '<form action="' . append_sid("admin_styles.$phpEx") . '" method="post"><input class="mainoption" type="submit" name="submit" value="' . $lang['Download'] . '" />' . $s_hidden_fields;

				$template->set_filenames(array(
					"body" => "message_body.tpl")
				);

				$template->assign_vars(array(
					"MESSAGE_TITLE" => $lang['Export_themes'],
					"MESSAGE_TEXT" => $lang['Download_theme_cfg'] . "<br /><br />" . $download_form)
				);

				$template->pparse('body');
				exit();
			}

			$result = @fputs($fp, $theme_data, strlen($theme_data));
			fclose($fp);

			$message = $lang['Theme_info_saved'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

		}
		else if($_POST['send_file'])
		{

			header("Content-Type: text/x-delimtext; name=\"theme_info.cfg\"");
			header("Content-disposition: attachment; filename=theme_info.cfg");

			echo stripslashes($_POST['theme_info']);
		}
		else
		{
			$template->set_filenames(array(
				"body" => "styles_exporter.tpl")
			);

			if( $dir = @opendir($root_path . 'templates/') )
			{
				$s_template_select = '<select name="template_name">';
				while( $file = @readdir($dir) )
				{
### R3-born - ADD (Global Admin Templates)
#
					if( !is_file(realpath($root_path . 'templates/' . $file)) && !is_link(realpath($root_path . 'templates/' .$file)) && $file != "." && $file != ".." && $file != "CVS" && $file != 'admin' )
#
### R3-born - END
					{
						$s_template_select .= '<option value="' . $file . '">' . $file . "</option>\n";
					}
				}
				$s_template_select .= '</select>';
			}
			else
			{
				message_die(GENERAL_MESSAGE, $lang['No_template_dir']);
			}

			$template->assign_vars(array(
				"L_STYLE_EXPORTER" => $lang['Export_themes'],
				"L_EXPORTER_EXPLAIN" => $lang['Export_explain'],
				"L_TEMPLATE_SELECT" => $lang['Select_template'],
				"L_SUBMIT" => $lang['Submit'],

				"S_EXPORTER_ACTION" => append_sid("admin_styles.$phpEx?mode=export"),
				"S_TEMPLATE_SELECT" => $s_template_select)
			);

			$template->pparse("body");

		}
		break;

	case "delete":
		$style_id = ( isset($_GET['style_id']) ) ? intval($_GET['style_id']) : intval($_POST['style_id']);

		if( !$confirm )
		{
			if($style_id == $config['default_style'])
			{
				message_die(GENERAL_MESSAGE, $lang['Cannot_remove_style']);
			}

			$hidden_fields = '<input type="hidden" name="mode" value="'.$mode.'" /><input type="hidden" name="style_id" value="'.$style_id.'" />';

			//
			// Set template files
			//
			$template->set_filenames(array(
				"confirm" => "confirm_body.tpl")
			);

			$template->assign_vars(array(
				"MESSAGE_TITLE" => $lang['Confirm'],
				"MESSAGE_TEXT" => $lang['Confirm_delete_style'],

				"L_YES" => $lang['Yes'],
				"L_NO" => $lang['No'],

				"S_CONFIRM_ACTION" => append_sid("admin_styles.$phpEx"),
				"S_HIDDEN_FIELDS" => $hidden_fields)
			);

			$template->pparse("confirm");

		}
		else
		{
			//
			// The user has confirmed the delete. Remove the style, the style element
			// names and update any users who might be using this style
			//
			$sql = "DELETE FROM " . THEMES_TABLE . "
				WHERE themes_id = $style_id";
			if(!$result = $db->sql_query($sql, BEGIN_TRANSACTION))
			{
				message_die(GENERAL_ERROR, "Could not remove style data!", "", __LINE__, __FILE__, $sql);
			}

			//
			// There may not be any theme name data so don't throw an error
			// if the SQL dosan't work
			/*
			$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
				WHERE themes_id = $style_id";
			$db->sql_query($sql);
			*/
			$sql = "UPDATE " . USERS_TABLE . "
				SET user_style = " . $config['default_style'] . "
				WHERE user_style = $style_id";
			if(!$result = $db->sql_query($sql, END_TRANSACTION))
			{
				message_die(GENERAL_ERROR, "Could not update user style information", "", __LINE__, __FILE__, $sql);
			}

			$message = $lang['Style_removed'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);
		}
		break;

	default:

		$sql = "SELECT themes_id, template_name, style_name
			FROM " . THEMES_TABLE . "
			ORDER BY template_name";
		if(!$result = $db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, "Could not get style information!", "", __LINE__, __FILE__, $sql);
		}

		$style_rowset = $db->sql_fetchrowset($result);

		// Start add - Slick Style Admin MOD
		if( $dir = @opendir($root_path . 'templates/') )
		{
			$s_template_select = '<select name="template_name">';
			while( $file = @readdir($dir) )
			{
				if( !is_file(realpath($root_path . 'templates/' . $file)) && !is_link(realpath($root_path . 'templates/' .$file)) && $file != "." && $file != ".." && $file != "CVS"  && $file != 'admin'  )
				{
					$s_template_select .= '<option value="' . $file . '">' . $file . "</option>\n";
				}
			}
			$s_template_select .= '</select>';
		}
		else
		{
			message_die(GENERAL_MESSAGE, $lang['No_template_dir']);
		}
		// End add - Slick Style Admin MOD

		$template->set_filenames(array(
			"body" => "styles_list_body.tpl")
		);

		$template->assign_vars(array(
			// Start add - Slick Style Admin MOD
			"S_ACTION" => append_sid("admin_styles.$phpEx"),
			"S_TEMPLATE_SELECT" => $s_template_select,

			"L_ADD_NEW" => $lang['Add_new'],
			"L_CREATE_NEW" => $lang['Create_new'],
			"L_EXPORT" => $lang['Export'],
			// End add - Slick Style Admin MOD
			"L_STYLES_TITLE" => $lang['Styles_admin'],
			"L_STYLES_TEXT" => $lang['Styles_explain'],
			"L_STYLE" => $lang['Style'],
			"L_TEMPLATE" => $lang['Template'],
			"L_EDIT" => $lang['Edit'],
			"L_DELETE" => $lang['Delete'])
		);

		for($i = 0; $i < count($style_rowset); $i++)
		{
			$row_class = ( !($i % 2) ) ? 'row1' : 'row2';

			$template->assign_block_vars("styles", array(
				"ROW_CLASS" => $row_class,
				"STYLE_NAME" => $style_rowset[$i]['style_name'],
				"TEMPLATE_NAME" => $style_rowset[$i]['template_name'],

				"U_STYLES_EDIT" => append_sid("admin_styles.$phpEx?mode=edit&amp;style_id=" . $style_rowset[$i]['themes_id']),
				"U_STYLES_DELETE" => append_sid("admin_styles.$phpEx?mode=delete&amp;style_id=" . $style_rowset[$i]['themes_id']))
			);
		}

		$template->pparse("body");
		break;
}

if (empty($_POST['send_file']))
{
	page_footer_admin();
}

?>